32
part-of
Part-Of relationship
Let create a logo consisting a circuit and a triangle. Let assume that a class Triangle have been defined.
class Logo {
attributes:
Circle circle
Triangle triangle
methods:
set(Point where)
}
Circle
Logo
Triangle
part-of

| You sometimes need to be able to build objects by combining them out of others. You already know this from procedural programming, where you have the
| structure or record construct to put data of various types together.
| Let's come back to our drawing program. You already have created several classes for the available figures. Now you decide that you want to have a special figure
| which represents your own logo which consists of a circle and a triangle. (Let's assume, that you already have defined a class Triangle.) Thus, your logo consists of
| two parts or the circle and triangle are part-of your logo.